package com.icinfo.cloud.provider.punish.common.documentdataload.controller;


import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.icinfo.cloud.common.core.Validator.BaseGroup;
import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.common.enums.TerritoryCodeEnum;
import com.icinfo.cloud.provider.common.enums.YesOrNoEnum;
import com.icinfo.cloud.provider.common.exception.BusinessException;
import com.icinfo.cloud.provider.common.utils.BaseUtil;
import com.icinfo.cloud.provider.common.utils.ConvertUpMoneyUtil;
import com.icinfo.cloud.provider.common.utils.DateUtil;
import com.icinfo.cloud.provider.punish.approval.vo.CaseApprovalCenterInfoVo;
import com.icinfo.cloud.provider.punish.common.caseregister.service.IRegisterCommonService;
import com.icinfo.cloud.provider.punish.common.documentdataload.dto.*;
import com.icinfo.cloud.provider.punish.common.documentdataload.service.IDocumentDataLoadService;
import com.icinfo.cloud.provider.punish.common.documentdataload.vo.CaseDocumentVo;
import com.icinfo.cloud.provider.punish.common.documentoperate.service.IStageDocCommonOperateService;
import com.icinfo.cloud.provider.punish.config.mapper.ConfigDictionaryInfoMapper;
import com.icinfo.cloud.provider.punish.config.model.ConfigDictionaryInfo;
import com.icinfo.cloud.provider.punish.config.service.ISysDepartParamService;
import com.icinfo.cloud.provider.punish.csource.manage.service.ICaseSourcePartyInfoService;
import com.icinfo.cloud.provider.punish.csource.manage.service.ICaseSourceRegisterMainInfoService;
import com.icinfo.cloud.provider.punish.csource.manage.vo.CaseSourceBasicInfoVo;
import com.icinfo.cloud.provider.punish.csource.manage.vo.CaseSourcePartyInfoVo;
import com.icinfo.cloud.provider.punish.ucase.casemain.dto.*;
import com.icinfo.cloud.provider.punish.ucase.casemain.mapper.CaseMainDetailAuxiliaryInfoMapper;
import com.icinfo.cloud.provider.punish.ucase.casemain.mapper.CaseMainInfoMapper;
import com.icinfo.cloud.provider.punish.ucase.casemain.mapper.CaseReasonMainRecordMapper;
import com.icinfo.cloud.provider.punish.ucase.casemain.model.*;
import com.icinfo.cloud.provider.punish.ucase.casemain.service.*;
import com.icinfo.cloud.provider.punish.ucase.casemain.vo.*;
import com.icinfo.cloud.provider.punish.ucase.investigateevidence.vo.CasePartyNoticeVo;
import com.icinfo.cloud.provider.punish.ucase.punishdecide.service.IPunishDecideService;
import com.icinfo.cloud.provider.punish.ucase.punishinform.dto.CriminalCaseTransferQueryDto;
import com.icinfo.cloud.provider.punish.ucase.punishinform.service.ICaseCriminalTransferService;
import com.icinfo.cloud.provider.punish.ucase.punishinform.vo.CaseCriminalTransferInfoVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.mybatis.mapper.entity.Example;
import com.icinfo.framework.tools.utils.StringUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 描述：文书数据接口方式加载公共入口
 *
 * @author tianrunjia
 * @date 2022-03-04
 */
@RestController
@RefreshScope
@RequestMapping("/punish/docdataload/documentdataload")
@Slf4j
public class DocumentDataLoadController {

    @Resource
    private ICaseAppendixRecordService caseAppendixRecordService;
    @Resource
    private IRegisterCommonService registerCommonService;

    @Resource
    private ICaseDocumentRecordService caseDocumentRecordService;
    @Autowired
    private ICaseMainDetailInfoService caseMainDetailInfoService;

    @Resource
    private ICaseMainDetailAuxiliaryInfoService caseMainDetailAuxiliaryInfoService;

    @Autowired
    private ICasePartiesRecordService casePartiesRecordService;
    @Resource
    private IPunishDecideService iPunishDecideService;

    @Autowired
    private ICaseMainEvidenceService caseMainEvidenceService;
    @Autowired
    private CaseMainInfoMapper caseMainInfoMapper;
    @Autowired
    private CaseMainDetailAuxiliaryInfoMapper caseMainDetailAuxiliaryInfoMapper;
    @Autowired
    private CaseReasonMainRecordMapper caseReasonMainRecordMapper;
    @Autowired
    private ISysDepartParamService sysDepartParamService;
    @Resource
    private ICaseMainInfoService caseMainInfoService;
    @Resource
    private ICaseHandlePersonRecordService caseHandlePersonRecordService;
    @Resource
    private ICaseSourcePartyInfoService caseSourcePartyInfoService;
    @Resource
    private ICaseSourceRegisterMainInfoService caseSourceRegisterMainInfoService;
    @Resource
    private ConfigDictionaryInfoMapper configDictionaryInfoMapper;
    @Resource
    private ICaseCriminalTransferService criminalCaseTransferervice;
    @Resource
    private IDocumentDataLoadService documentDataLoadService;
    @Resource
    private IStageDocCommonOperateService stageDocCommonOperateService;


    /**
     * 获取处罚内容(普通程序案件, 简易程序案件, 补录案件)
     *
     * @param dto
     * @return
     */
    @PostMapping("/getCaseRevokePunishContent")
    public Result<String> getCaseRevokePunishContent(@RequestBody CaseDataQueryDto dto) {
        String caseId = dto.getCaseId();
        //处罚内容
        String caseRevokePunishContent = stageDocCommonOperateService.getCaseRevokePunishContent(caseId);
        return Result.success(Constant.STRING_SUCCESS_EN, caseRevokePunishContent);
    }

    /**
     * 【V1.0.0】描述：获取案件证据列表
     *
     * @param queryDto {@link CaseAttachmentInfoQueryDto}
     * @return {@link Result < List <CaseAttachmentInfoVo>} 案件附件列表
     * @author cyy
     * @date 2022-03-04
     */
    @PostMapping("/getCaseEvidenceList")
    @ApiOperation(value = "【V1.0.0】描述：获取案件证据列表", httpMethod = "POST")
    public Result<List<CaseAttachmentInfoVo>> getCaseEvidenceList(@RequestBody @Validated CaseEvidenceQueryDto queryDto) {
        CaseAttachmentInfoQueryDto qto = new CaseAttachmentInfoQueryDto();
        qto.setCaseId(queryDto.getCaseId());
        qto.setDocumentCatalogCode(queryDto.getDocumentCatalogCode());
        qto.setAttachmentTypeId("EVIDENCE");
        List<CaseAttachmentInfoVo> list = caseAppendixRecordService.getCaseAttachmentList(qto);
        return Result.success(Constant.STRING_GET_SUCCESS, list);
    }

    /**
     * 【V1.0.0】描述：获取案件证据名称拼接(证据共享库)
     *
     * @param caseId {@link CaseAttachmentInfoQueryDto}
     * @return {@link Result < List <CaseAttachmentInfoVo>} 获取案件证据名称拼接(证据共享库)
     * @author cyy
     * @date 2022-03-14
     */
    @GetMapping("/getCaseEvidenceShareStr")
    @ApiOperation(value = "【V1.0.0】描述：获取案件证据名称拼接(证据共享库)", httpMethod = "GET")
    public Result<String> getCaseEvidenceShareStr(@RequestParam("caseId") String caseId) {
        return Result.success("success", caseMainEvidenceService.getEvidenceNameStr(caseId));
    }

    /**
     * 【V1.0.0】描述：根据唯一标识查询文书记录信息
     *
     * @param queryDto 查询dto
     * @return {@link Result<CaseDocumentRecordDetailVo> }
     * @author shishengyao
     * @date 2022/03/04
     */
    @PostMapping("/getCaseDocumentRecordInfo")
    @ApiOperation(value = "【V1.0.0】描述：根据唯一标识查询文书记录信息", httpMethod = "POST")
    public Result<CaseDocumentSingleRecordVo> getCaseDocumentRecordInfoDetail(@RequestBody @Validated CaseDocumentRecordQueryDto queryDto) {
        CaseDocumentSingleRecordVo vo = caseDocumentRecordService.getCaseDocumentRecordForCommon(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    /**
     * 【V1.0.0】描述：调查终结报告-处罚建议数据获取
     *
     * @param dto
     * @return
     * @author trj
     * @date 2022-03-04
     */
    @PostMapping("/getPunishSuggestion")
    public Result<String> getPunishSuggestion(@RequestBody CaseDataQueryDto dto) {
        //处罚建议
        String punishSuggestion="";
        CaseMainDetailInfo caseMainDetailInfo = caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
        //处理结论；0 行政处罚,1 涉刑移送 2 行政处理
        String handleConclusion = caseMainDetailInfo.getHandleConclusion();
        CaseMainInfo caseMainInfo=caseMainInfoMapper.selectByPrimaryKey(dto.getCaseId());
        //案件案由、当事人类型；1：单案由单当事人 2：多案由单当事人 3：单案由多当事人
        String casePartiesReasonType= caseMainInfo.getCasePartiesReasonType();
        //处置方式；0：常规处罚 1：合并处罚 2：分别处罚;
        String handleType= caseMainInfo.getHandleType();
        if(Constant.STRING_2.equals(handleConclusion)){

            Example example=new Example(CaseMainDetailAuxiliaryInfo.class);
            if(StringUtils.isNotEmpty(dto.getPartyId())&&!dto.getPartyId().contains(",")){
                example.createCriteria().andEqualTo("caseId",dto.getCaseId()).andEqualTo("partyId",dto.getPartyId());
            }else{
                example.createCriteria().andEqualTo("caseId",dto.getCaseId());
            }
            List<CaseMainDetailAuxiliaryInfo> caseMainDetailAuxiliaryInfos=caseMainDetailAuxiliaryInfoMapper.selectByExample(example);

            if(CollectionUtil.isNotEmpty(caseMainDetailAuxiliaryInfos)){
                if(Constant.STRING_0.equals(handleType)||Constant.STRING_1.equals(handleType)){
                    punishSuggestion += caseMainDetailAuxiliaryInfos.get(0).getDisposeContext();
                }else{
                    punishSuggestion += " \n";
                    for (CaseMainDetailAuxiliaryInfo caseMainDetailAuxiliaryInfo:caseMainDetailAuxiliaryInfos) {
                        punishSuggestion += "处予 "+caseMainDetailAuxiliaryInfo.getPartyName()+"："+caseMainDetailAuxiliaryInfo.getDisposeContext()+" \n";
                    }
                    if(StringUtils.isNotEmpty(punishSuggestion)&&punishSuggestion.length()>3){
                        punishSuggestion = punishSuggestion.substring(0,punishSuggestion.length()-1);
                    }
                }
               return  Result.success("获取成功",punishSuggestion);
            }
        }
        //是否为农业农村
        boolean isNync=false;
        if(TerritoryCodeEnum.NYNC.getCode().equals(caseMainInfo.getCaseTerritoryCode())){
            isNync=true;
        }
        if (ObjectUtils.isEmpty(caseMainDetailInfo)) {
            throw new BusinessException("案件详情信息为空！");
        }else{
            if(Constant.STRING_1.equals(casePartiesReasonType)||Constant.STRING_2.equals(casePartiesReasonType)||(Constant.STRING_3.equals(casePartiesReasonType)&&Constant.STRING_1.equals(handleType))){
                punishSuggestion=getPunishSuggestionStrByCaseMainDetailInfo(caseMainDetailInfo,isNync);
            }else {
                Example example=new Example(CaseMainDetailAuxiliaryInfo.class);
                if(StringUtils.isBlank(dto.getPartyId())||dto.getPartyId().contains(",")){
                    example.createCriteria().andEqualTo("caseId",dto.getCaseId());
                }else{
                    example.createCriteria().andEqualTo("caseId",dto.getCaseId()).andEqualTo("partyId",dto.getPartyId());
                }
                List<CaseMainDetailAuxiliaryInfo> caseMainDetailAuxiliaryInfos=caseMainDetailAuxiliaryInfoMapper.selectByExample(example);
                for (CaseMainDetailAuxiliaryInfo caseMainDetailAuxiliaryInfo:caseMainDetailAuxiliaryInfos) {
                    String singlePunishSuggestion=getPunishSuggestionStrByCaseMainDetailAuxiliaryInfo(caseMainDetailAuxiliaryInfo,dto.getPartyId(),isNync);
                    punishSuggestion=punishSuggestion+singlePunishSuggestion;
                }
                if(isNync){
                    punishSuggestion=punishSuggestion.substring(0,punishSuggestion.length()-1);
                }
            }
            return Result.success("获取成功",punishSuggestion);
        }
    }

    /**
     * 获取加处罚款决定书循环体信息
     * @param dto
     * @return
     */
    @PostMapping("/getAddPunishDataInfo")
    public Result<Map> getAddPunishDataInfo(@RequestBody CaseDataQueryDto dto) {
        CaseMainDetailInfo caseMainDetailInfo = caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
        CaseMainInfo caseMainInfo=caseMainInfoMapper.selectByPrimaryKey(dto.getCaseId());
        //处置方式；0：常规处罚 1：合并处罚 2：分别处罚;
        String handleType= caseMainInfo.getHandleType();
        return Result.success("");
    }

    private String getPunishSuggestionStrByCaseMainDetailAuxiliaryInfo(CaseMainDetailAuxiliaryInfo caseMainDetailAuxiliaryInfo,String partyId,Boolean isNync) {
        String addStr="";
        if(isNync){
            addStr="\n";
        }
        String punishSuggestionDsr="";
        if(StringUtils.isBlank(partyId)||partyId.contains(",")){
            punishSuggestionDsr="\n"+"处予 "+caseMainDetailAuxiliaryInfo.getPartyName()+"：\n";
        }
        String punishSuggestion="";
        String sequenceNumber="";
        String punctuation ="；";
        String investConclusion=caseMainDetailAuxiliaryInfo.getInvestConclusion();
        String punishKinds=caseMainDetailAuxiliaryInfo.getPunishKinds();
        if(Constant.STRING_1.equals(investConclusion)){
            //予以处罚
            String[] punishKindsArr = punishKinds.split(",");
            for (int i=1;i<=punishKindsArr.length;i++){
                String punishKind=punishKindsArr[i-1];
                if (punishKindsArr.length>1){
                    if(i>1) {
                        sequenceNumber ="  " +i + "、";
                    }else{
                        sequenceNumber =i + "、";
                    }
                }
                if (i==punishKindsArr.length){
                    punctuation ="";
                }
                String draftPunishMoneyUp =ConvertUpMoneyUtil.toChinese(caseMainDetailAuxiliaryInfo.getDraftPunishMoney());
                String draftPunishMoneyUpTwoDecimals =BaseUtil.convertTwoDecimals(caseMainDetailAuxiliaryInfo.getDraftPunishMoney());
                String confiscateIllegalMoneyUp= ConvertUpMoneyUtil.toChinese(caseMainDetailAuxiliaryInfo.getConfiscateIllegalMoney());
                String confiscateIllegalMoneyTwoDecimals=BaseUtil.convertTwoDecimals(caseMainDetailAuxiliaryInfo.getConfiscateIllegalMoney());
                if("罚款".equals(punishKind)){
                    punishSuggestion=punishSuggestion+sequenceNumber+"处罚款人民币"+draftPunishMoneyUp+"整（¥"+draftPunishMoneyUpTwoDecimals+")"+punctuation+addStr;
                }else if("没收违法所得、没收非法财物".equals(punishKind)){
                    String value = caseMainDetailAuxiliaryInfo.getConfiscateIllegalPropertyValue();
                    if(StringUtils.isNotBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalMoney())&&StringUtils.isBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty())){
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")"+punctuation+addStr;
                    }
                    if(StringUtils.isBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalMoney())&&StringUtils.isNotBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty())){
                        if(StringUtils.isNotBlank(value)){
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+ "（价值¥"+value+"）"+punctuation+addStr;
                        }else {
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+punctuation+addStr;
                        }
                    }
                    if(StringUtils.isNotBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalMoney())&&StringUtils.isNotBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty())){
                        if(StringUtils.isNotBlank(value)){
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")，没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+ "（价值¥"+value+"）"+punctuation+addStr;
                        }else {
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")，没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+punctuation+addStr;
                        }
                    }
                }else if("没收违法所得".equals(punishKind)){
                    punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")"+punctuation+addStr;
                }else if("没收非法财物".equals(punishKind)){
                    if(StringUtils.isNotBlank(caseMainDetailAuxiliaryInfo.getConfiscateIllegalPropertyValue())){
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+ "（价值¥"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalPropertyValue()+"）"+punctuation+addStr;
                    }else {
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty()+punctuation+addStr;
                    }
                }else{
                    if(!isNync){
                        punishSuggestion=punishSuggestion+sequenceNumber+punishKind+punctuation;
                    }else{
                        punishSuggestion=punishSuggestion+sequenceNumber+punishKind+punctuation+addStr;
                    }

                }
            }
            return  punishSuggestionDsr+punishSuggestion;
        }else if(Constant.STRING_2.equals(investConclusion)){
            //不予处罚
            punishSuggestion=punishSuggestionDsr+"鉴于当事人（"+this.getDicFileNameByCode(caseMainDetailAuxiliaryInfo.getNotGivePunishReason())+"） ，故依据《中华人民共和国行政处罚法》（第三十条/第三十一条/第三十三条）的规定，建议不予行政处罚";
            return punishSuggestion;
        }
        return punishSuggestion;
    }

    private String getPunishSuggestionStrByCaseMainDetailInfo(CaseMainDetailInfo caseMainDetailInfo,Boolean isNync) {
        String investConclusion=caseMainDetailInfo.getInvestConclusion();
        String punishKinds=caseMainDetailInfo.getPunishKinds();
        String punishSuggestion="";
        String sequenceNumber="";
        String punctuation ="；";
        String addStr="";
        if(isNync){
            addStr="\n";
        }
        if(Constant.STRING_1.equals(investConclusion)){
            //予以处罚
            String[] punishKindsArr = punishKinds.split(",");
            for (int i=1;i<=punishKindsArr.length;i++){
                String punishKind=punishKindsArr[i-1];
                if (punishKindsArr.length>1){
                    if(i>1) {
                        sequenceNumber ="  " +i + "、";
                    }else{
                        sequenceNumber =i + "、";
                    }
                }
                if (i==punishKindsArr.length){
                    punctuation ="";
                }
                if("罚款".equals(punishKind)){
                    String draftPunishMoneyUp =ConvertUpMoneyUtil.toChinese(caseMainDetailInfo.getDraftPunishMoney());
                    String draftPunishMoneyUpTwoDecimals =BaseUtil.convertTwoDecimals(caseMainDetailInfo.getDraftPunishMoney());
                    punishSuggestion=punishSuggestion+sequenceNumber+"处罚款人民币"+draftPunishMoneyUp+"整（¥"+draftPunishMoneyUpTwoDecimals+")"+punctuation+addStr;
                }else if("没收违法所得、没收非法财物".equals(punishKind)){
                    String confiscateIllegalMoneyUp= ConvertUpMoneyUtil.toChinese(caseMainDetailInfo.getConfiscateIllegalMoney());
                    String confiscateIllegalMoneyTwoDecimals=BaseUtil.convertTwoDecimals(caseMainDetailInfo.getConfiscateIllegalMoney());
                    String value = caseMainDetailInfo.getConfiscateIllegalPropertyValue();
                    if(StringUtils.isNotBlank(caseMainDetailInfo.getConfiscateIllegalMoney())&&StringUtils.isBlank(caseMainDetailInfo.getConfiscateIllegalProperty())){
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")"+punctuation+addStr;
                    }
                    if(StringUtils.isBlank(caseMainDetailInfo.getConfiscateIllegalMoney())&&StringUtils.isNotBlank(caseMainDetailInfo.getConfiscateIllegalProperty())){
                        if(StringUtils.isNotBlank(value)){
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty()+ "（价值¥"+value+"）" +punctuation+addStr;
                        }else {
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty() +punctuation+addStr;
                        }
                    }
                    if(StringUtils.isNotBlank(caseMainDetailInfo.getConfiscateIllegalMoney())&&StringUtils.isNotBlank(caseMainDetailInfo.getConfiscateIllegalProperty())){
                        if(StringUtils.isNotBlank(value)){
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")，没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty()+ "（价值¥"+value+"）" +punctuation+addStr;
                        }else {
                            punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")，没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty()+punctuation+addStr;
                        }
                    }
                }else if("没收违法所得".equals(punishKind)){
                    String confiscateIllegalMoneyUp= ConvertUpMoneyUtil.toChinese(caseMainDetailInfo.getConfiscateIllegalMoney());
                    String confiscateIllegalMoneyTwoDecimals=BaseUtil.convertTwoDecimals(caseMainDetailInfo.getConfiscateIllegalMoney());
                    punishSuggestion=punishSuggestion+sequenceNumber+"没收违法所得人民币"+confiscateIllegalMoneyUp+"整（¥"+confiscateIllegalMoneyTwoDecimals+")"+punctuation+addStr;
                }else if("没收非法财物".equals(punishKind)){
                    if(StringUtils.isNotBlank(caseMainDetailInfo.getConfiscateIllegalPropertyValue())){
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty()+ "（价值¥"+caseMainDetailInfo.getConfiscateIllegalPropertyValue()+"）"+punctuation+addStr;
                    }else {
                        punishSuggestion=punishSuggestion+sequenceNumber+"没收违法财物包括"+caseMainDetailInfo.getConfiscateIllegalProperty()+punctuation+addStr;
                    }
                }else{
                    if(!isNync) {
                        punishSuggestion = punishSuggestion + sequenceNumber + "" + punishKind + punctuation;
                    }else{
                        punishSuggestion = punishSuggestion + sequenceNumber + "" + punishKind + punctuation+addStr;
                    }
                }
            }
            if(isNync){
                punishSuggestion=punishSuggestion.substring(0,punishSuggestion.length()-1);
            }
            return  punishSuggestion;
        }else if(Constant.STRING_2.equals(investConclusion)){
            //不予处罚
            punishSuggestion="鉴于当事人（"+this.getDicFileNameByCode(caseMainDetailInfo.getNotGivePunishReason())+"） ，故依据《中华人民共和国行政处罚法》（第三十条/第三十一条/第三十三条）的规定，建议不予行政处罚";
            return punishSuggestion;
        }
        return punishSuggestion;
    }

    /**
     * 描述：调查终结报告-处罚建议数据获取（涉刑）
     * @author liyafeng
     * @date 2022/9/27
      * @param dto
     * @return {@link Result< String>}
     */
    @PostMapping("/getCriminalCasePunishSuggestion")
    public Result<String> getCriminalCasePunishSuggestion(@RequestBody CaseDataQueryDto dto) {
        StringBuffer IllegalBasisFormat = new StringBuffer("");
        Example example=new Example(CaseReasonMainRecord.class);
        example.createCriteria().andEqualTo("caseId",dto.getCaseId()).andEqualTo("status",Constant.STRING_1);
        List<CaseReasonMainRecord> caseReasonMainRecords=caseReasonMainRecordMapper.selectByExample(example);
        for (CaseReasonMainRecord caseReasonMainRecord:caseReasonMainRecords) {
            if(StringUtils.isBlank(IllegalBasisFormat)){
                IllegalBasisFormat.append(caseReasonMainRecord.getIllegalBasisFormat());
            }else{
                IllegalBasisFormat.append("、");
                IllegalBasisFormat.append(caseReasonMainRecord.getIllegalBasisFormat());
            }

        }
        String criminalSuggestion="1、当事人的行为违反了"+IllegalBasisFormat+"的规定，属"+caseReasonMainRecords.get(0).getCaseReasonNameSimple()+"行为。\n" +
                "2、当事人的行为应属已涉嫌犯罪。\n" +
                "3、根据《中华人民共和国行政处罚法》第八条及第二十七条、《行政执法机关移送涉嫌犯罪案件的规定》（国务院第310号令）规定，建议对当事人违法行为作如下处理：建议移送公安机关依法处理。";
        return Result.success("获取成功",criminalSuggestion);
    }

    /**
     * 获取办案人员（主办，协办）人员信息+ 办案人员签名信息
     *
     * @param caseId
     * @return
     * @author lxj
     * @date 2022/3/4
     **/
    @RequestMapping("/getCaseHandleAndSignMsg")
    public Result<CasePartyNoticeVo> getCaseHandleAndSignMsg(@RequestParam(value = "caseId") String caseId) {

        CasePartyNoticeVo vo = registerCommonService.getCaseHandleAndSignMsg(caseId);
        return Result.success(vo);
    }

    /**
     * 描述：获取处罚告知书的信息
     *
     * @param infoQueryDto 信息查询dto
     * @return {@link Result<CaseDocumentRecordDetailVo> }
     * @author shishengyao
     * @date 2022/03/12
     */
    @PostMapping("/getPunishInformInfo")
    public Result<CaseDocumentRecordDetailVo> getPunishInformInfo(@RequestBody @Validated PunishInformInfoQueryDto infoQueryDto) {
       try {
           CaseDocumentRecordQueryDto queryDto=new CaseDocumentRecordQueryDto();
           BeanUtils.copyProperties(infoQueryDto,queryDto);
           CaseDocumentRecordDetailVo vo = caseDocumentRecordService.getPunishInformInfo(queryDto);
           return Result.success(vo);
       }catch (Exception e){
           e.printStackTrace();
       }
        return Result.error("查询失败");
    }

    /**
     * 获取缴款信息
     *
     * @return {@link Result<Map<String, String>> } 缴款信息
     * @author shishengyao
     * @date 2022/03/12
     */
    @GetMapping("/getPaymentInfo")
    public Result<Map<String, String>> getPaymentInfo() {
        // FIXME: 2022/3/17 该接口如果前端有调用入参需要再做调整
        Map<String, String> paymentInfo = iPunishDecideService.getPaymentInfo("test");
        return Result.success(Constant.STRING_GET_SUCCESS, paymentInfo);
    }

    /**
     * 描述：获取当事人信息接口（弃用）
     *
     * @param caseId
     * @return {@link Result<CasePartiesDetailInfoVo> }
     * @author shishengyao
     * @date 2022/03/21
     */
//    @GetMapping("/getCasePartiesInfo")
//    public Result<CasePartiesDetailInfoVo> getCasePartiesInfo(@RequestParam(value = "caseId") String caseId) {
//        CasePartiesDetailInfoVo vo = casePartiesRecordService.getCasePartiesDetailInfo(caseId);
//        return Result.success(Constant.STRING_GET_SUCCESS, vo);
//    }

    /**
     * 【V2.0.0】描述：查询案件联合法制审核相关信息
     *
     * @param caseId 案件id
     * @return {@link Result<List< CaseApprovalCenterInfoVo > >} 案件联合法制审核相关信息
     * @author tianrunjia
     * @date 2022-05-24 20:21
     */
    @PostMapping("/getCaseApprovalCenterInfo")
    @ApiOperation(value = "【V2.0.0】描述：查询案件联合法制审核相关信息", httpMethod = "POST")
    public Result<CaseApprovalCenterInfoVo> getCaseApprovalCenterInfo(@RequestParam String caseId) {
        CaseApprovalCenterInfoVo vo = sysDepartParamService.getIsApprovalCenterConfig(caseId);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }

    /**
     * 描述：获取当事人信息接口
     *
     * @param queryDto 查询dto
     * @return {@link Result<List<Map<String, Object>>> }
     * @author shishengyao
     * @date 2022/05/26
     */
    @PostMapping("/getCasePartiesInfoList")
    public Result<List<Map<String, Object>>> getCasePartiesInfoList(@RequestBody @Validated CasePartiesQueryDto queryDto) {
        List<Map<String, Object>> list = null;
        try {
            list = casePartiesRecordService.getCasePartiesDetailInfoList(queryDto);
            return Result.success(Constant.STRING_GET_SUCCESS, list);
        } catch (Exception e) {
            e.printStackTrace();

        }
        return Result.error(Constant.STRING_GET_FAIL);
    }

    /**
     * 【V1.0.0】描述：调查终结报告-处罚建议数据获取
     *
     * @param dto
     * @return
     * @author trj
     * @date 2022-03-04
     */
    @PostMapping("/getPunishOpinion")
    public Result<String> getCasePunishOpinion(@RequestBody CaseDataQueryDto dto) {
        String caseId=dto.getCaseId();
        //处罚建议
        String punishOpinion="";
        CaseMainDetailInfo caseMainDetailInfo = caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
        //处理结论；0 行政处罚,1 涉刑移送 2 行政处理
        CaseMainInfo caseMainInfo=caseMainInfoMapper.selectByPrimaryKey(dto.getCaseId());
        //案件案由、当事人类型；1：单案由单当事人 2：多案由单当事人 3：单案由多当事人
        String casePartiesReasonType= caseMainInfo.getCasePartiesReasonType();
        //处置方式；0：常规处罚 1：合并处罚 2：分别处罚;
        String handleType= caseMainInfo.getHandleType();
        if(Constant.STRING_2.equals(handleType)){
            CaseMainDetailAuxiliaryInfoRequest request=new CaseMainDetailAuxiliaryInfoRequest();
            request.setCaseId(caseId);
            request.setPartyId(dto.getPartyId());
            List<CaseMainDetailAuxiliaryInfo> caseMainDetailAuxiliaryInfoList = caseMainDetailAuxiliaryInfoService.getCaseMainDetailAuxiliaryInfo(request);
            if (ObjectUtil.isNotEmpty(caseMainDetailAuxiliaryInfoList)){
                punishOpinion=caseMainDetailAuxiliaryInfoList.get(0).getPunishContent();
            }
        }else {
            punishOpinion = caseMainDetailInfo.getPunishContent();
        }
        return Result.success("获取成功",punishOpinion);
    }

    /**
     * 【V2.0.0】描述：公共文书生成获取数据
     * @param dto
     * @return
     * @author trj
     * @date 2022-03-04
     */
    @PostMapping("/getCommonData")
    public Result<Map<String, Object>> getAfjg(@RequestBody CaseDataQueryDto dto) {
        Map<String,Object> resultMap=new HashMap<>();
       /* CaseMainInfo caseMainInfo=caseMainInfoMapper.selectByPrimaryKey(caseId);
        String casePartiesReasonType=caseMainInfo.getCasePartiesReasonType();*/
        //List<CasePartiesRecordVo> casePartiesRecords=casePartiesRecordService.getCasePartiesInfo(caseId);
       /* Example example=new Example(CasePartiesRecord.class);
        example.createCriteria().andEqualTo("caseId",caseId).andEqualTo("status",Constant.STRING_1);
        example.setOrderByClause(" party_type desc ");
        example.setOrderByClause(" create_time asc ");
        List<CasePartiesRecord> casePartiesRecords=casePartiesRecordMapper.selectByExample(example);*/
        /*List<String> partyNameList=new ArrayList<>();
        for (CasePartiesRecordVo casePartiesRecord:casePartiesRecords) {
            partyNameList.add(casePartiesRecord.getPartyName());
        }*/
        CaseMainInfo caseMainInfo=caseMainInfoMapper.selectByPrimaryKey(dto.getCaseId());
        String casePartiesReasonType=caseMainInfo.getCasePartiesReasonType();
        Example reasonExample=new Example(CaseReasonMainRecord.class);
        reasonExample.createCriteria().andEqualTo("caseId",dto.getCaseId()).andEqualTo("status","1");
        List<CaseReasonMainRecord> caseReasonMainRecords=caseReasonMainRecordMapper.selectByExample(reasonExample);
        List<String> caseReasonList=new ArrayList<>();
        String caseReasons="";
        for (CaseReasonMainRecord caseReasonMainRecord:caseReasonMainRecords) {
            caseReasonMainRecord.setCaseReasonName(BaseUtil.handleCaseReason(caseReasonMainRecord.getCaseReasonName()));
            caseReasonList.add(caseReasonMainRecord.getCaseReasonName());
            if(StringUtils.isBlank(caseReasons)){
                caseReasons=caseReasonMainRecord.getCaseReasonName();
            }else{
                caseReasons=caseReasons+"、"+caseReasonMainRecord.getCaseReasonName();
            }
        }
        List<String> casePartyNameList=new ArrayList<>();
        String casePartyNames="";
        List<CasePartiesInfoVo> casePartiesInfos=casePartiesRecordService.getCasePartiesInfoVo(dto.getCaseId(),dto.getPartyId());
        for (CasePartiesInfoVo casePartiesInfoVo:casePartiesInfos) {
            casePartiesInfoVo.setBirth(DateUtil.formatDateStr(casePartiesInfoVo.getBirth()));
            casePartyNameList.add(casePartiesInfoVo.getPartyName());
            if(StringUtils.isBlank(casePartyNames)){
                casePartyNames=casePartiesInfoVo.getPartyName();
            }else{
                casePartyNames=casePartyNames+"、"+casePartiesInfoVo.getPartyName();
            }
        }
        CaseMainDetailInfo caseMainDetailInfo=caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
        String caseHappenAddressDetail=caseMainDetailInfo.getCaseHappenAddressDetail();
        String caseConciseCondition=caseMainDetailInfo.getCaseConciseCondition();
        String caseHappenTime= DateTimeFormatter.ofPattern("yyyy年M月d日").format(caseMainDetailInfo.getCaseHappenTime());
        String caseRegisterTime=caseMainDetailInfo.getCaseRegisterTime();
        String investigationEndDate=caseMainDetailInfo.getInvestigationEndDate();
         String punishOpinion=  caseMainDetailInfo.getPunishOpinion();
        resultMap.put("punishOpinion",punishOpinion);
        resultMap.put("caseConciseCondition",caseConciseCondition);
        resultMap.put("caseRegisterTime", DateUtil.formatDateStr(caseRegisterTime));
        resultMap.put("investigationEndDate",DateUtil.formatDateStr(investigationEndDate));
        resultMap.put("caseHappenAddressDetail",caseHappenAddressDetail);
        resultMap.put("caseHappenTime",caseHappenTime);
        resultMap.put("caseReasonList",caseReasonList);
        resultMap.put("casePartiesInfos",casePartiesInfos);
        resultMap.put("caseReasonMainRecords",caseReasonMainRecords);
        resultMap.put("caseReasons",caseReasons);
        resultMap.put("casePartyNameList",casePartyNameList);
        resultMap.put("casePartyNames",casePartyNames);
        resultMap.put("casePartiesReasonType",casePartiesReasonType);
        return Result.success("获取成功", resultMap);
    }

    /**
     * 描述：获取案件基础信息
     *
     * @param queryDto 查询dto
     * @return {@link Result<CaseMainDetailInfoCommonVo> }
     * @author shishengyao
     * @date 2022/12/01
     */
    @PostMapping("/getCaseMainInfo")
    public Result<CaseMainDetailInfoCommonVo> getCaseMainInfo(@RequestBody @Validated CaseDataQueryDto queryDto) {
        try {
            CaseMainDetailInfoCommonVo caseMainDetailInfoCommonVo = caseMainDetailInfoService.getCaseMainDetailInfoCommonVoByCaseId(queryDto);
            return Result.success(Constant.STRING_GET_SUCCESS, caseMainDetailInfoCommonVo);
        } catch (Exception e) {
            e.printStackTrace();

        }
        return Result.error(Constant.STRING_GET_FAIL);
    }

    /**
     * 描述：查询文书文号信息记录列表
     *
     * @param queryDto 查询dto
     * @return {@link Result<List<CaseDocumentRecordDto>> }
     * @author shishengyao
     * @date 2022/06/06
     */
    @PostMapping("/getCaseDocumentRecordDocNumberInfoList")
    public Result< List<CaseDocumentRecordDetailVo>> getCaseDocumentRecordDocNumberInfoList(@RequestBody @Validated CaseDocumentRecordCommonQueryDto queryDto) {
        try {
            List<CaseDocumentRecordDetailVo> caseDocumentRecordList = caseDocumentRecordService.getCaseDocumentRecordDocNumberInfoList(queryDto);
            return Result.success(Constant.STRING_GET_SUCCESS, caseDocumentRecordList);
        } catch (Exception e) {
            e.printStackTrace();

        }
        return Result.error(Constant.STRING_GET_FAIL);
    }

    /**
     * 描述：查询案件办案人员信息
     *
     * @param caseId 用例id
     * @return {@link Result<List<CaseHandlePersonRecordVo>> }
     * @author shishengyao
     * @date 2022/08/03
     */
    @GetMapping("/getCaseHandlePersonRecordList")
    public Result<List<CaseHandlePersonRecord>>  getCaseHandlePersonRecordList(@RequestParam("caseId")String caseId){
        List<CaseHandlePersonRecord> voList = caseHandlePersonRecordService.getCaseHandlePersonRecordList(caseId);
        return Result.success("获取成功", voList);
    }


    /**
     * 描述：查询案源当事人信息列表
     *
     * @param caseSourceId 案件源id
     * @return {@link Result<List<CaseSourcePartyInfoVo>> }
     * @author shishengyao
     * @date 2022/08/18
     */
    @GetMapping("/getCaseSourcePartyPersonRecordList")
    public Result<List<CaseSourcePartyInfoVo>>  getCaseSourcePartyPersonRecordList(@RequestParam("caseSourceId")String caseSourceId){
        List<CaseSourcePartyInfoVo> voList = caseSourcePartyInfoService.getCaseSourcePartyInfo(caseSourceId);
        return Result.success("获取成功", voList);
    }

    /**
     * 描述：查询案源信息
     *
     * @param caseSourceId 案件源id
     * @return {@link Result<List<CaseSourcePartyInfoVo>> }
     * @author shishengyao
     * @date 2022/08/18
     */
    @GetMapping("/getCaseSourceInfo")
    public Result<CaseSourceBasicInfoVo>  getCaseSourceInfo(@RequestParam("caseSourceId")String caseSourceId){
        CaseSourceBasicInfoVo vo = caseSourceRegisterMainInfoService.getCaseSourceBasicInfoVo(caseSourceId);
        return Result.success("获取成功", vo);
    }

    /**
     * 描述：不予处罚告知-不予处罚原因获取
     * @author liyafeng
     * @date 2022/9/27
     * @param dto
     * @return {@link Result< String>}
     */
    @PostMapping("/getNotGivePunishReason")
    public Result<Map<String,Object>> getNotGivePunishReason(@RequestBody CaseDataQueryDto dto) {
        String  notGivePunishReasonCode = "";
        String  notGivePunishReasonName = "";
        String  notGivePunishDetail = "";
        CaseMainInfoVo caseMainInfoVo=caseMainInfoMapper.selectCaseMainInfo(dto.getCaseId());
        //案件案由、当事人类型；1：单案由单当事人 2：多案由单当事人 3：单案由多当事人
        String casePartiesReasonType= caseMainInfoVo.getCasePartiesReasonType();
        //处置方式；0：常规处罚 1：合并处罚 2：分别处罚;
        String handleType= caseMainInfoVo.getHandleType();
        if(Constant.STRING_1.equals(casePartiesReasonType)||(Constant.STRING_3.equals(casePartiesReasonType)&&Constant.STRING_1.equals(handleType))){
            CaseMainDetailInfo caseMainDetailInfo=caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
            notGivePunishReasonCode=caseMainDetailInfo.getNotGivePunishReason();
            notGivePunishReasonName=getDicFileNameByCode(notGivePunishReasonCode);
            notGivePunishDetail=caseMainDetailInfo.getNotGivePunishDetail();

        }else {
            Example example=new Example(CaseMainDetailAuxiliaryInfo.class);
            if(StringUtils.isBlank(dto.getPartyId())){
                example.createCriteria().andEqualTo("caseId",dto.getCaseId());
            }else{
                example.createCriteria().andEqualTo("caseId",dto.getCaseId()).andEqualTo("partyId",dto.getPartyId());
            }
            List<CaseMainDetailAuxiliaryInfo> caseMainDetailAuxiliaryInfos=caseMainDetailAuxiliaryInfoMapper.selectByExample(example);
            for (CaseMainDetailAuxiliaryInfo caseMainDetailAuxiliaryInfo:caseMainDetailAuxiliaryInfos) {
                notGivePunishReasonCode=caseMainDetailAuxiliaryInfo.getNotGivePunishReason();
                //notGivePunishReasonName=getDicFileNameByCode(notGivePunishReasonCode);
                if(StringUtils.isBlank(notGivePunishReasonName)){
                    notGivePunishReasonName=getDicFileNameByCode(notGivePunishReasonCode);
                    notGivePunishDetail=caseMainDetailAuxiliaryInfo.getNotGivePunishDetail();
                }else{
                    notGivePunishReasonName=notGivePunishReasonName+";"+getDicFileNameByCode(notGivePunishReasonCode);
                    notGivePunishDetail=notGivePunishDetail+";"+caseMainDetailAuxiliaryInfo.getNotGivePunishDetail();
                }
            }
        }
        Map<String,Object> map=new HashMap<>();
        map.put("notGivePunishReasonName",notGivePunishReasonName);
        map.put("notGivePunishDetail",notGivePunishDetail);
        return Result.success("获取成功",map);
    }

    private String getDicFileNameByCode(String notGivePunishReasonCode) {
        String notGivePunishReasonName="";
        Example example=new Example(ConfigDictionaryInfo.class);
        example.createCriteria().andEqualTo("dicFieldCode","NOT_GIVE_PUNISH_REASON").andEqualTo("dicCode",notGivePunishReasonCode);
        List<ConfigDictionaryInfo> configDictionaryInfos=configDictionaryInfoMapper.selectByExample(example);
        if(!ObjectUtils.isEmpty(configDictionaryInfos)){
            notGivePunishReasonName=configDictionaryInfos.get(0).getDicName();
        }
        return notGivePunishReasonName;
    }

    /**
     * 【V1.5.0】描述：获取涉刑移送单数据
     *
     * @param queryDto 查询dto
     * @return {@link Result< CaseCriminalTransferInfoVo > }
     * @author shishengyao
     * @date 2022/09/27
     */
    @PostMapping(value = "/getCriminalCaseTransferInfo", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<CaseCriminalTransferInfoVo> getCriminalCaseTransferInfo(@RequestBody @Validated(BaseGroup.Query.class) CriminalCaseTransferQueryDto queryDto) {
        return Result.success(criminalCaseTransferervice.getCriminalCaseTransferInfo(queryDto));
    }

    /**
     * 获取案件处罚相关信息
     *
     * @param dto
     * @return
     */
    @PostMapping("/getCasePunishInfos")
    public Result<Map<String,Object>> getCasePunishInfos(@RequestBody CaseDataQueryDto dto) {
        //没收非法财物
        String confiscateIllegalProperty = "";
        String punishContent = "";
        String noPunishContent = "";
        String investConclusion = "";
        String executeWay = "";
        CaseMainInfoVo caseMainInfoVo=caseMainInfoMapper.selectCaseMainInfo(dto.getCaseId());
        //案件案由、当事人类型；1：单案由单当事人 2：多案由单当事人 3：单案由多当事人
        String casePartiesReasonType= caseMainInfoVo.getCasePartiesReasonType();
        //处置方式；0：常规处罚 1：合并处罚 2：分别处罚;
        String handleType= caseMainInfoVo.getHandleType();
        if(Constant.STRING_1.equals(casePartiesReasonType)||(Constant.STRING_3.equals(casePartiesReasonType)&&Constant.STRING_1.equals(handleType))){
            CaseMainDetailInfo caseMainDetailInfo=caseMainDetailInfoService.getCaseMainDetailByCaseId(dto.getCaseId());
            String punishKinds = caseMainDetailInfo.getPunishKinds();
            if(punishKinds.contains("没收非法财物")){
                confiscateIllegalProperty = caseMainDetailInfo.getConfiscateIllegalProperty();
            }
            //处罚内容
            investConclusion = caseMainDetailInfo.getInvestConclusion();
            if (YesOrNoEnum.YES.getCode().equals(investConclusion)) {
                punishContent = caseMainDetailInfo.getPunishContent();
            } else {
                noPunishContent = caseMainDetailInfo.getPunishContent();
            }

            executeWay = caseMainDetailInfo.getExecuteWay();

        }else {
            Example example=new Example(CaseMainDetailAuxiliaryInfo.class);
            example.createCriteria().andEqualTo("caseId",dto.getCaseId());
            List<CaseMainDetailAuxiliaryInfo> caseMainDetailAuxiliaryInfos=caseMainDetailAuxiliaryInfoMapper.selectByExample(example);
            for (CaseMainDetailAuxiliaryInfo caseMainDetailAuxiliaryInfo:caseMainDetailAuxiliaryInfos) {
                String punishKinds = caseMainDetailAuxiliaryInfo.getPunishKinds();
                if(punishKinds.contains("没收非法财物")){
                    confiscateIllegalProperty += caseMainDetailAuxiliaryInfo.getConfiscateIllegalProperty();
                }
                //处罚内容
                investConclusion = caseMainDetailAuxiliaryInfo.getInvestConclusion();
                if (YesOrNoEnum.YES.getCode().equals(investConclusion)) {
                    punishContent += caseMainDetailAuxiliaryInfo.getPunishDocumentNumber() + ":\n" + caseMainDetailAuxiliaryInfo.getPunishContent() + "\n";
                } else {
                    noPunishContent += caseMainDetailAuxiliaryInfo.getPunishDocumentNumber() + ":\n" + caseMainDetailAuxiliaryInfo.getPunishContent() + "\n";
                }
            }
            //调查结论
            Set<String> investConclusionSet = caseMainDetailAuxiliaryInfos.stream().map(e -> e.getInvestConclusion()).collect(Collectors.toSet());
            if (investConclusionSet.size() == 1) {
                investConclusion = investConclusionSet.iterator().next();

                if (YesOrNoEnum.YES.getCode().equals(investConclusion)) {
                    //执行方式
                    Set<String> executeWaySet = caseMainDetailAuxiliaryInfos.stream().map(e -> e.getExecuteWay()).collect(Collectors.toSet());
                    if (executeWaySet.size() == 1) {
                        executeWay = executeWaySet.iterator().next();
                    }
                }
            }
        }
        Map<String,Object> map=new HashMap<>();
        map.put("confiscateIllegalProperty", confiscateIllegalProperty);
        map.put("punishContent", punishContent);
        map.put("noPunishContent", noPunishContent);
        map.put("investConclusion", investConclusion);
        map.put("executeWay", executeWay);
        return Result.success("获取成功",map);
    }

    /**
     * 获取补正/更正文书中特定的信息
     * @return
     */
    @PostMapping("/getDocumentInfo")
    public Result<CaseDocumentVo> getCorrectDocumentInfo(@RequestBody CaseDocumentDto dto){
        return Result.success(documentDataLoadService.getDocumentInfo(dto));
    }

    /**
     * 【V1.11.3】描述： 获取陈述申辩相关内容
     *
     * @author: zhengqiang
     * @date: 2023/4/7
     * @param: dto
     * @return {@link Result< Map< String, Object>>}
     **/
    @PostMapping("/getStatementDefendContent")
    public Result<Map<String,Object>> getStatementDefendContent(@RequestBody CaseDataQueryDto dto) {
        return Result.success(documentDataLoadService.getStatementDefendContent(dto));
    }
}
